import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const IntelligentDiscoveryMeta: IPublicTypeComponentMetadata = {
  componentName: 'IntelligentDiscovery',
  title: '智能发现',
  category: '信息展示',
  group: '综合执法',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'IntelligentDiscovery',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '容器宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '容器高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '容器背景色'
    },
    {
      name: 'borderRadius',
      propType: 'number',
      description: '容器圆角'
    },
    {
      name: 'discoveryItems',
      propType: 'array',
      description: '发现项目配置'
    },
    {
      name: 'itemSpacing',
      propType: 'number',
      description: '项目间距'
    },
    {
      name: 'itemWidth',
      propType: 'number',
      description: '项目宽度'
    },
    {
      name: 'itemHeight',
      propType: 'number',
      description: '项目高度'
    },
    {
      name: 'columns',
      propType: 'number',
      description: '列数'
    },
    {
      name: 'titleFontSize',
      propType: 'number',
      description: '标题字体大小'
    },
    {
      name: 'titleColor',
      propType: 'string',
      description: '标题颜色'
    },
    {
      name: 'titleFontFamily',
      propType: 'string',
      description: '标题字体'
    },
    {
      name: 'titleFontWeight',
      propType: 'number',
      description: '标题字体粗细'
    },
    {
      name: 'titleLineHeight',
      propType: 'number',
      description: '标题行高'
    },
    {
      name: 'titleLetterSpacing',
      propType: 'number',
      description: '标题字间距'
    },
    {
      name: 'valueFontSize',
      propType: 'number',
      description: '数值字体大小'
    },
    {
      name: 'valueColor',
      propType: 'string',
      description: '数值颜色'
    },
    {
      name: 'valueFontFamily',
      propType: 'string',
      description: '数值字体'
    },
    {
      name: 'valueFontWeight',
      propType: 'number',
      description: '数值字体粗细'
    },
    {
      name: 'valueLineHeight',
      propType: 'number',
      description: '数值行高'
    },
    {
      name: 'valueLetterSpacing',
      propType: 'number',
      description: '数值字间距'
    },
    {
      name: 'valueBackground',
      propType: 'string',
      description: '数值背景'
    },
    {
      name: 'iconSize',
      propType: 'number',
      description: '图标大小'
    },
    {
      name: 'iconSpacing',
      propType: 'number',
      description: '图标间距'
    },
    {
      name: 'progressHeight',
      propType: 'number',
      description: '进度条高度'
    },
    {
      name: 'progressBorderWidth',
      propType: 'number',
      description: '进度条边框宽度'
    },
    {
      name: 'progressOpacity',
      propType: 'number',
      description: '进度条透明度'
    },
    {
      name: 'layout',
      propType: 'string',
      description: '布局方式'
    },
    {
      name: 'gap',
      propType: 'number',
      description: '间距'
    },
    {
      name: 'onItemClick',
      propType: 'func',
      description: '项目点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      // 容器配置
      {
        name: 'container',
        type: 'group',
        display: 'accordion',
        title: {
          label: '容器配置',
        },
        items: [
          {
            name: 'width',
            title: { label: '容器宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 500 }
          },
          {
            name: 'height',
            title: { label: '容器高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 400 }
          },
          {
            name: 'backgroundColor',
            title: { label: '容器背景色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'transparent' }
          },
          {
            name: 'borderRadius',
            title: { label: '容器圆角' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0 }
          }
        ]
      },
      // 数据项配置
      {
        name: 'items',
        type: 'group',
        display: 'accordion',
        title: {
          label: '数据项配置',
        },
        items: [
          {
            name: 'discoveryItems',
            title: { label: '发现项目配置' },
            setter: { componentName: 'JsonSetter', isRequired: false, initialValue: [
              {
                title: '累计发现事件数量',
                value: '99',
                iconPath: 'http://localhost:8085/static/images/zonghezhifa/bz54.png',
                showProgress: false
              },
              {
                title: '已处理事件数量',
                value: '85',
                iconPath: 'http://localhost:8085/static/images/zonghezhifa/bz54.png',
                showProgress: true,
                progressValue: 85,
                progressColor: 'radial-gradient(241% 94% at 52% 97%, rgba(22,241,255,0.81) 0%, rgba(22,213,255,0.81) 11%, rgba(22,129,255,0) 84%)',
                progressBackground: 'transparent',
                progressBorderColor: 'linear-gradient(180deg, rgba(83, 176, 255, 0), rgba(190, 246, 254, 0.95))'
              },
              {
                title: '事件处理率',
                value: '85.9%',
                iconPath: 'http://localhost:8085/static/images/zonghezhifa/bz54.png',
                showProgress: false
              },
              {
                title: '今日新发现事件数',
                value: '12',
                iconPath: 'http://localhost:8085/static/images/zonghezhifa/bz54.png',
                showProgress: false
              },
              {
                title: '今日处理事件数',
                value: '8',
                iconPath: 'http://localhost:8085/static/images/zonghezhifa/bz54.png',
                showProgress: false
              }
            ]}
          },
          {
            name: 'itemSpacing',
            title: { label: '项目间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
          },
          {
            name: 'itemWidth',
            title: { label: '项目宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 128 }
          },
          {
            name: 'itemHeight',
            title: { label: '项目高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 64 }
          },
          {
            name: 'columns',
            title: { label: '列数' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 3 }
          }
        ]
      },
      // 标题配置
      {
        name: 'title',
        type: 'group',
        display: 'accordion',
        title: {
          label: '标题配置',
        },
        items: [
          {
            name: 'titleFontSize',
            title: { label: '标题字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
          },
          {
            name: 'titleColor',
            title: { label: '标题颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
          },
          {
            name: 'titleFontFamily',
            title: { label: '标题字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'SourceHanSansSC' }
          },
          {
            name: 'titleFontWeight',
            title: { label: '标题字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 400 }
          },
          {
            name: 'titleLineHeight',
            title: { label: '标题行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 22 }
          },
          {
            name: 'titleLetterSpacing',
            title: { label: '标题字间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0 }
          }
        ]
      },
      // 数值配置
      {
        name: 'value',
        type: 'group',
        display: 'accordion',
        title: {
          label: '数值配置',
        },
        items: [
          {
            name: 'valueFontSize',
            title: { label: '数值字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 24 }
          },
          {
            name: 'valueColor',
            title: { label: '数值颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
          },
          {
            name: 'valueFontFamily',
            title: { label: '数值字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'DINAlternate' }
          },
          {
            name: 'valueFontWeight',
            title: { label: '数值字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 700 }
          },
          {
            name: 'valueLineHeight',
            title: { label: '数值行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 28 }
          },
          {
            name: 'valueLetterSpacing',
            title: { label: '数值字间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.86 }
          },
          {
            name: 'valueBackground',
            title: { label: '数值背景' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)' }
          }
        ]
      },
      // 图标配置
      {
        name: 'icon',
        type: 'group',
        display: 'accordion',
        title: {
          label: '图标配置',
        },
        items: [
          {
            name: 'iconSize',
            title: { label: '图标大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 64 }
          },
          {
            name: 'iconSpacing',
            title: { label: '图标间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 8 }
          }
        ]
      },
      // 进度条配置
      {
        name: 'progress',
        type: 'group',
        display: 'accordion',
        title: {
          label: '进度条配置',
        },
        items: [
          {
            name: 'progressHeight',
            title: { label: '进度条高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
          },
          {
            name: 'progressBorderWidth',
            title: { label: '进度条边框宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 2 }
          },
          {
            name: 'progressOpacity',
            title: { label: '进度条透明度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.4 }
          }
        ]
      },
      // 布局配置
      {
        name: 'layout',
        type: 'group',
        display: 'accordion',
        title: {
          label: '布局配置',
        },
        items: [
          {
            name: 'layout',
            title: { label: '布局方式' },
            setter: {
              componentName: 'RadioGroupSetter',
              isRequired: false,
              initialValue: 'grid',
              props: {
                options: [
                  { label: '网格', value: 'grid' },
                  { label: '弹性', value: 'flex' }
                ]
              }
            }
          },
          {
            name: 'gap',
            title: { label: '间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
          }
        ]
      }
    ],
    supports: {
      style: true,
      className: true,
      events: ['onItemClick', 'onClick']
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '智能发现',
    screenshot: '',
    schema: {
      componentName: 'IntelligentDiscovery',
      props: {
        width: 500,
        height: 240,
        backgroundColor: 'transparent',
        borderRadius: 0,
        discoveryItems: [
          {
            title: '累计发现事件数量',
            value: '99',
            iconPath: 'static/images/zonghezhifa/zhin-icon-bg.png',
            showProgress: false
          },
          {
            title: '已处理事件数量',
            value: '85',
            iconPath: 'static/images/zonghezhifa/zhin-icon-bg.png',
            showProgress: true,
            progressValue: 85,
            progressColor: 'radial-gradient(241% 94% at 52% 97%, rgba(22,241,255,0.81) 0%, rgba(22,213,255,0.81) 11%, rgba(22,129,255,0) 84%)',
            progressBackground: 'transparent',
            progressBorderColor: 'linear-gradient(180deg, rgba(83, 176, 255, 0), rgba(190, 246, 254, 0.95))'
          },
          {
            title: '事件处理率',
            value: '85.9%',
            iconPath: 'static/images/zonghezhifa/zhin-icon-bg.png',
            showProgress: false
          },
          {
            title: '今日新发现事件数',
            value: '12',
            iconPath: 'static/images/zonghezhifa/zhin-icon-bg.png',
            showProgress: false
          },
          {
            title: '今日处理事件数',
            value: '8',
            iconPath: 'static/images/zonghezhifa/zhin-icon-bg.png',
            showProgress: false
          }
        ],
        itemSpacing: 20,
        itemWidth: 128,
        itemHeight: 64,
        columns: 3,
        titleFontSize: 16,
        titleColor: '#FFFFFF',
        titleFontFamily: 'SourceHanSansSC',
        titleFontWeight: 400,
        titleLineHeight: 22,
        titleLetterSpacing: 0,
        valueFontSize: 24,
        valueColor: '#1AD7FF',
        valueFontFamily: 'DINAlternate',
        valueFontWeight: 700,
        valueLineHeight: 28,
        valueLetterSpacing: 0.86,
        valueBackground: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)',
        iconSize: 64,
        iconSpacing: 8,
        progressHeight: 20,
        progressBorderWidth: 2,
        progressOpacity: 0.4,
        layout: 'grid',
        gap: 20
      }
    }
  }
];

export default {
  ...IntelligentDiscoveryMeta,
  snippets
};
